﻿Public Class ClassWaitProcess
    Sub New(ByVal NomProcess As String)
        Dim strComputer = "."
        Dim intI = 1
        Dim objWMIService = GetObject("winmgmts:" _
            & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

        Dim colProcessList = objWMIService.ExecQuery _
            ("Select * from Win32_Process Where Name = '" & NomProcess & "'")
        While intI > 0
            intI = 0
            colProcessList = objWMIService.ExecQuery _
            ("Select * from Win32_Process Where Name = '7za.exe'")
            For Each oproc In colProcessList
                intI = intI + 1
            Next
        End While
    End Sub
End Class
